Fix a malloc race condition involving strsignal.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 1 Oct 2012 22:12:44 +0000 (15:12 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 1 Oct 2012 22:12:44 +0000 (15:12 -0700)
commit4611741c80d91fe5faffff3143a45bdb1919b171
treeb9a54c0b79b20d7e72c9c0dc8958c6f870093ded
parent8280b10656650dc69b5fc532e3d3fcab5073d4ff
Fix a malloc race condition involving strsignal.

A signal can arrive in the middle of a malloc, and Emacs's signal
handler can invoke strsignal, which can invoke malloc, which is
not portable.  This race condition bug makes Emacs hang on GNU/Linux.
Fix it by altering the signal handler so that it does not invoke
strsignal.
* emacs.c (shut_down_emacs): Use safe_strsignal, not strsignal.
* process.c (status_message): Use const pointer, in case strsignal
is #defined to safe_strsignal.
* sysdep.c (sys_siglist, init_signals): Always define and
initialize a substitute sys_siglist if the system does not define
one, even if HAVE_STRSIGNAL.
(safe_strsignal): Rename from strsignal.  Always define,
using sys_siglist.  Return a const pointer.
* syssignal.h (safe_strsignal): New decl.
(strsignal) [!HAVE_STRSIGNAL]: Define in terms of safe_strsignal.
src/ChangeLog
src/emacs.c
src/process.c
src/sysdep.c
src/syssignal.h